home *** CD-ROM | disk | FTP | other *** search
/ .net (French) 1996 November / .net Magazine (FR) - Issue 01 - Nov 1996.iso / mac / Butineur / Netscape Plug-ins / KM's QuickTime plug / Sources / npapi.p < prev    next >
Text File  |  1996-02-04  |  6KB  |  207 lines

  1. unit npapi;
  2. interface
  3.  
  4. uses Quickdraw, Events, Printing;
  5.  
  6. {
  7. npapi.p.  My personal translation of Netscape's npapi.h file from the New SDK 0.7.
  8. Interface bugs are probably mine, not Netscape's.
  9. Kevin McMurtrie  mcmurtri@wco.com
  10. 2/3/95
  11.  
  12. Original info:
  13.     npapi.h $Revision: 1.56 $
  14.     Netscape client plug-in API spec
  15. }
  16.  
  17.  
  18.  
  19. {
  20.     Version constants
  21.  }
  22.  
  23. const
  24. NP_VERSION_MAJOR = 0;
  25. NP_VERSION_MINOR = 6;
  26.  
  27.  
  28.  
  29.     Basic types
  30.  }
  31.  
  32.  
  33.  
  34. type
  35. charstar = ^packed array [1..1] of char;
  36. arglist = ^packed array [1..1] of charstar;
  37.  
  38. {
  39. PROCEDURE C2PStrProc(aStr: UNIV Ptr);
  40. FUNCTION C2PStr(cString: UNIV Ptr): StringPtr;
  41. PROCEDURE P2CStrProc(aStr: StringPtr);
  42. FUNCTION P2CStr(pString: StringPtr): Ptr;
  43. }
  44.  
  45. NPError = integer;
  46. NPMIMEType = charstar;
  47.  
  48.  
  49. {
  50.     NPP is a plug-in's opaque instance handle
  51.  }
  52.  
  53. NPP = record    {NOW VAR, NOT POINTER}
  54.     pdata: Ptr;                { plug-in private data }
  55.     ndata: Ptr;                { netscape private data }
  56.     end;
  57.  
  58.  
  59.  
  60. NPStream = record    {NOW VAR, NOT POINTER}
  61.     pdata: Ptr;                    { plug-in private data }
  62.     ndata: Ptr;                    { netscape private data }
  63.     url: charstar;                { CONST}
  64.     TheEnd: longint;
  65.     lastmodified: longint;
  66.     end;
  67.  
  68.  
  69. NPByteRange = record
  70.     offset: longint;                { negative offset means from the end }
  71.     length: longint;
  72.     next: ^NPByteRange;
  73.     end;
  74.  
  75.  
  76.  
  77. NPSavedData = record
  78.     len: longint;
  79.     buf: array [0..0] of SignedByte;
  80.     end;
  81. NPSavedDataPtr = ^NPSavedData;
  82.  
  83. NP_Port = record
  84.     port: CGrafPtr;           { Grafport }
  85.     portx: longint;          { how far away the top window corner is from object (neg #s)}
  86.     porty: longint;
  87.     end;
  88.  
  89. NPWindow = record 
  90.     window: ^NP_Port;            { platform specific window handle }
  91.     x: longint;                    { position of top left corner relative to a netscape page }
  92.     y: longint;
  93.     width: longint;                { maximum window size }
  94.     height: longint;
  95.     clipRect: Rect;                { clipping rectangle in port coordinates }
  96.     end;
  97. NPWindowPtr = ^NPWindow;
  98.  
  99.  
  100. NPFullPrint = record
  101.     pluginPrinted: boolean;        { Set TRUE if plugin handled fullscreen printing }
  102.     printOne: boolean;            { TRUE if plugin should print one copy to default printer }
  103.     platformPrint: THPrint;        { Platform-specific printing info }
  104. end;
  105.  
  106. NPEmbedPrint = record
  107.     window: NPWindow;
  108.     platformPrint: THPrint;        { Platform-specific printing info }
  109. end;
  110.  
  111.  
  112. NPPrint = record
  113.     mode: integer;                { NP_FULL or NP_EMBED }
  114.     case integer of
  115.         1: (fullPrint: NPFullPrint;);        { if mode is NP_FULL }
  116.         2: (embedPrint: NPEmbedPrint;);        { if mode is NP_EMBED }
  117. end;
  118.  
  119.  
  120. { Mac-specific structures and definitions.}
  121.  
  122. {
  123.     Non-standard event types that can be passed to HandleEvent
  124.  }
  125. const
  126. getFocusEvent = (osEvt + 16);
  127. loseFocusEvent = (osEvt + 17);
  128. adjustCursorEven = (osEvt + 18);
  129.  
  130. NP_EMBED = 1;
  131. NP_FULL = 2;
  132. NP_BACKGROUND = 3;
  133.  
  134. NP_NORMAL = 1;
  135. NP_SEEK = 2;
  136. NP_ASFILE = 3;
  137.  
  138. {#define NP_MAXREADY (((unsigned)(~0)<<1)>>1)   Huh?!?!?!?}
  139.  
  140.  
  141. {
  142.  *  Error and reason code definitions.
  143.  }
  144.  
  145. NP_NOERR = 0;
  146. NP_EINVAL = 1;
  147. NP_EABORT = 2;
  148.  
  149. NPERR_BASE = 0;
  150. NPERR_NO_ERROR = (NPERR_BASE + 0);
  151. NPERR_GENERIC_ERROR = (NPERR_BASE + 1);
  152. NPERR_INVALID_INSTANCE_ERROR = (NPERR_BASE + 2);
  153. NPERR_INVALID_FUNCTABLE_ERROR = (NPERR_BASE + 3);
  154. NPERR_MODULE_LOAD_FAILED_ERROR = (NPERR_BASE + 4);
  155. NPERR_OUT_OF_MEMORY_ERROR = (NPERR_BASE + 5);
  156. NPERR_INVALID_PLUGIN_ERROR = (NPERR_BASE + 6);
  157. NPERR_INVALID_PLUGIN_DIR_ERROR = (NPERR_BASE + 7);
  158. NPERR_INCOMPATIBLE_VERSION_ERROR = (NPERR_BASE + 8);
  159.  
  160. NPRES_BASE = 0;
  161. NPRES_NETWORK_ERR = (NPRES_BASE + 0);
  162. NPRES_USER_BREAK = (NPRES_BASE + 1);
  163. NPRES_DONE = (NPRES_BASE + 3);
  164.  
  165.  
  166.  
  167. {
  168.     Function prototypes.
  169.     Functions beginning with 'NPP' are functions provided by the plugin that Netscape will call.
  170.     Functions beginning with 'NPN' are functions provided by Netscape that the plugin will call.
  171.  }
  172.  
  173. {
  174. NPError               NPP_Initialize(void);
  175. void                  NPP_Shutdown(void);
  176. NPError     NP_LOADDS NPP_New(NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, char* argn[], char* argv[], NPSavedData* saved);
  177. NPError     NP_LOADDS NPP_Destroy(NPP instance, NPSavedData** save);
  178. NPError     NP_LOADDS NPP_SetWindow(NPP instance, NPWindow* window);
  179. NPError     NP_LOADDS NPP_NewStream(NPP instance, NPMIMEType type, NPStream* stream, NPBool seekable, uint16* stype);
  180. NPError     NP_LOADDS NPP_DestroyStream(NPP instance, NPStream* stream, NPError reason);
  181. int32       NP_LOADDS NPP_WriteReady(NPP instance, NPStream* stream);
  182. int32       NP_LOADDS NPP_Write(NPP instance, NPStream* stream, int32 offset, int32 len, void* buffer);
  183. void        NP_LOADDS NPP_StreamAsFile(NPP instance, NPStream* stream, const char* fname);
  184. void        NP_LOADDS NPP_Print(NPP instance, NPPrint* platformPrint);
  185. int16                 NPP_HandleEvent(NPP instance, void* event);
  186.  
  187. void        NPN_Version(int* plugin_major, int* plugin_minor, int* netscape_major, int* netscape_minor);
  188. NPError     NPN_GetURL(NPP instance, const char* url, const char* window);
  189. NPError     NPN_PostURL(NPP instance, const char* url, uint32 len, const char* buf, NPBool file);
  190. NPError     NPN_RequestRead(NPStream* stream, NPByteRange* rangeList);
  191. NPError     NPN_NewStream(NPP instance, NPMIMEType type, NPStream* stream);
  192. int32       NPN_Write(NPP instance, NPStream* stream, int32 len, void* buffer);
  193. NPError     NPN_DestroyStream(NPP instance, NPStream* stream, NPError reason);
  194. void        NPN_Status(NPP instance, const char* message);
  195. const char* NPN_UserAgent(NPP instance);
  196. void*       NPN_MemAlloc(uint32 size);
  197. void        NPN_MemFree(void* ptr);
  198. uint32      NPN_MemFlush(uint32 size);
  199. void        NPN_ReloadPlugins(NPBool reloadPages);
  200.  
  201. }
  202.  
  203. implementation
  204. end.
  205.  
  206.